package com.xhgj.thread;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author 周宇
 * @create 2020-06-27 22:54
 * 使用线程模拟倒计时
 */
public class CountDownSheep {
    public static void main(String[] args) throws InterruptedException {
        tenDown();
    }

    private static void tenDown() throws InterruptedException {
        //获取系统当前时间
        Date now = new Date(System.currentTimeMillis());
        while (true) {
            Thread.sleep(1000);
            System.out.println(new SimpleDateFormat("HH:mm:ss").format(now));
            now = new Date(System.currentTimeMillis());
        }
    }
}
